package com.my.springBoot.business.service.impl;

import java.util.List;
import com.my.springBoot.utils.DateUtils;
import com.my.springBoot.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.my.springBoot.business.mapper.ComplaintTypeMapper;
import com.my.springBoot.business.domain.ComplaintType;
import com.my.springBoot.business.service.IComplaintTypeService;

/**
 * 投诉类型Service业务层处理
 * 
 * @author ${author}
 * @date 2024-01-13
 */
@Service
public class ComplaintTypeServiceImpl extends ServiceImpl<ComplaintTypeMapper, ComplaintType> implements IComplaintTypeService
{
    @Autowired
    private ComplaintTypeMapper complaintTypeMapper;

    /**
     * 查询投诉类型
     * 
     * @param id 投诉类型主键
     * @return 投诉类型
     */
    @Override
    public ComplaintType selectComplaintTypeById(Long id)
    {
        return complaintTypeMapper.selectComplaintTypeById(id);
    }

    /**
     * 查询投诉类型列表
     * 
     * @param complaintType 投诉类型
     * @return 投诉类型
     */
    @Override
    public List<ComplaintType> selectComplaintTypeList(ComplaintType complaintType)
    {
        return complaintTypeMapper.selectComplaintTypeList(complaintType);
    }

    /**
     * 新增投诉类型
     * 
     * @param complaintType 投诉类型
     * @return 结果
     */
    @Override
    public int insertComplaintType(ComplaintType complaintType)
    {
        complaintType.setCreateBy(SecurityUtils.getUsername());
        complaintType.setCreateTime(DateUtils.getNowDate());
        return complaintTypeMapper.insertComplaintType(complaintType);
    }

    /**
     * 修改投诉类型
     * 
     * @param complaintType 投诉类型
     * @return 结果
     */
    @Override
    public int updateComplaintType(ComplaintType complaintType)
    {
        complaintType.setUpdateBy(SecurityUtils.getUsername());
        complaintType.setUpdateTime(DateUtils.getNowDate());
        return complaintTypeMapper.updateComplaintType(complaintType);
    }

    /**
     * 批量删除投诉类型
     * 
     * @param ids 需要删除的投诉类型主键
     * @return 结果
     */
    @Override
    public int deleteComplaintTypeByIds(Long[] ids)
    {
        return complaintTypeMapper.deleteComplaintTypeByIds(ids);
    }

    /**
     * 删除投诉类型信息
     * 
     * @param id 投诉类型主键
     * @return 结果
     */
    @Override
    public int deleteComplaintTypeById(Long id)
    {
        return complaintTypeMapper.deleteComplaintTypeById(id);
    }
}
